zynqmp: pm: Added APIs for xilsecure linux support
authorSiva Durga Prasad Paladugu <[email protected]>
Tue, 1 May 2018 05:42:55 +0000 (11:12 +0530)
committerSiva Durga Prasad Paladugu <[email protected]>
Thu, 17 May 2018 09:42:59 +0000 (15:12 +0530)
Added SHA to calculate SHA3 hash,RSA to encrypt data with
public key and decrypt with private key and AES to do symmetric
encryption with User key or device key.

Signed-off-by: Siva Durga Prasad Paladugu <[email protected]>
plat/xilinx/zynqmp/pm_service/pm_api_sys.c
plat/xilinx/zynqmp/pm_service/pm_api_sys.h
plat/xilinx/zynqmp/pm_service/pm_svc_main.c

index 4b709abff67cdb6adfc36ad45f01fb9511b03cc7..6f3d098474e32769ecd9d81a3bdd3057730b18c8 100644 (file)
@@ -1138,3 +1138,29 @@ enum pm_ret_status pm_query_data(enum pm_query_id qid,
 
        return ret;
 }
+
+enum pm_ret_status pm_sha_hash(uint32_t address_high,
+                                   uint32_t address_low,
+                                   uint32_t size,
+                                   uint32_t flags)
+{
+       uint32_t payload[PAYLOAD_ARG_CNT];
+
+       /* Send request to the PMU */
+       PM_PACK_PAYLOAD5(payload, PM_SECURE_SHA, address_high, address_low,
+                                size, flags);
+       return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
+}
+
+enum pm_ret_status pm_rsa_core(uint32_t address_high,
+                                   uint32_t address_low,
+                                   uint32_t size,
+                                   uint32_t flags)
+{
+       uint32_t payload[PAYLOAD_ARG_CNT];
+
+       /* Send request to the PMU */
+       PM_PACK_PAYLOAD5(payload, PM_SECURE_RSA, address_high, address_low,
+                                size, flags);
+       return pm_ipi_send_sync(primary_proc, payload, NULL, 0);
+}
index e850b79e127ab739b7361775a4e2d9b48ae38b01..40ebc030d1b55fe3b38d1280c91a0fb7207cf299 100644 (file)
@@ -153,4 +153,12 @@ enum pm_ret_status pm_query_data(enum pm_query_id qid,
                                 unsigned int arg2,
                                 unsigned int arg3,
                                 unsigned int *data);
+enum pm_ret_status pm_sha_hash(uint32_t address_high,
+                                   uint32_t address_low,
+                                   uint32_t size,
+                                   uint32_t flags);
+enum pm_ret_status pm_rsa_core(uint32_t address_high,
+                                   uint32_t address_low,
+                                   uint32_t size,
+                                   uint32_t flags);
 #endif /* _PM_API_SYS_H_ */
index 5a4da90ebce294a328f143f7100ed686efb14150..84bd887a283fa5adf9a367cf281ff603762a2b57 100644 (file)
@@ -387,6 +387,16 @@ uint64_t pm_smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,
                ret = pm_set_suspend_mode(pm_arg[0]);
                SMC_RET1(handle, (uint64_t)ret);
 
+       case PM_SECURE_SHA:
+               ret = pm_sha_hash(pm_arg[0], pm_arg[1], pm_arg[2],
+                               pm_arg[3]);
+               SMC_RET1(handle, (uint64_t)ret);
+
+       case PM_SECURE_RSA:
+               ret = pm_rsa_core(pm_arg[0], pm_arg[1], pm_arg[2],
+                                      pm_arg[3]);
+               SMC_RET1(handle, (uint64_t)ret);
+
        default:
                WARN("Unimplemented PM Service Call: 0x%x\n", smc_fid);
                SMC_RET1(handle, SMC_UNK);